<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<script type="text/javascript" src="../js/isWeixin.js"></script>
	<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="0" />
	<script type="text/javascript" src="../js/flexible.min.js"></script>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="apple-touch-fullscreen" content="YES" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta name="apple-mobile-web-app-status-bar-style" content="black" />
	<meta name="format-detection" content="telephone=no" />
	<meta name="format-detection" content="email=no" />
	<meta name="author" content="persona" />
	<link rel="shortcut icon" href="../images/eCar_icon.png" type="image/png">
	<title>分享收益</title>
	<link rel="stylesheet" type="text/css" href="../css/reset.css">
	<style type="text/css">
		body {font-family: Tahoma,Helvetica,"microsoft yahei","Hiragino Sans GB",Simsun,\5b8b\4f53,sans-serif; width: 10rem; margin: 0 auto;}
		.logo {width: 2.56rem; height: auto; text-align: center; margin: 0.48rem auto; display: block;}
		.title {font-size: 15px; text-align: center; color: #505050; margin-bottom: 0.4rem; font-weight: bold;}
		[data-dpr="2"] .title {font-size: 30px;}
		[data-dpr="3"] .title {font-size: 45px;}
		.intro {font-size: 12px; text-align: justify; color: #999; line-height: 1.75; margin:0 0.48rem 0.5rem;}
		[data-dpr="2"] .intro {font-size: 24px;}
		[data-dpr="3"] .intro {font-size: 36px;}
		.intro-b {font-weight: bold;}
		.open-tip {display: none; position: fixed; left:0; top:0; bottom:0; background: #000; opacity: 0.8; filter:alpha(opacity=80);  height: 100%; width: 100%; z-index: 900;}
		.open-tip div {width: 9rem; text-align: center; margin: 10% auto 0%; position: relative;}
		.open-tip div img {width: 100%; height: auto;}
		.open-tip div p {position: absolute; width: 3.01rem; height: 1.22rem; left: 2.86rem; bottom: 0.75rem; border-radius: 0.2rem;}
	</style>
</head>
<body>
	<img class="logo" src="images/appdown_logo.png" />
	<p class="title">分享三重获益</p>
	<p class="intro">被分享人首次购买车险，商业车险最高立减50%！</p>
	<p class="intro intro-b">一级分享</p>
	<p class="intro">分享「e车险保」APP邀请好友购买车险，您即成为“一级分享”，可获得成交商业车险保费2.5%的红包；</p>
	<p class="intro intro-b">二级分享</p>
	<p class="intro">好友再次分享成为您的“二级分享”，可获得成交商业车险保费的1.5%的红包；</p>
	<p class="intro intro-b">三级分享</p>
	<p class="intro">好友的好友再次分享成为您的“三级分享”，可获得成交商业车险保费的1%的红包。</p>
	<div class="open-tip">
		<div>
			<img src="images/share_other.png"/>
			<p></p>
		</div>
	</div>
	<div class="black-bg"></div>

	<script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="../js/common.js"></script>
	<script type="text/javascript"
	src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script type="text/javascript">
		window.onload = function(){
			function shareInOut(time){
				var winHeight = $(window).height();
				clearTimeout(texttimer);
				var texttimer = setTimeout(function(){
					$(".open-tip").css("height",winHeight);
					$(".open-tip").show();
				},time);
			}

			$(".open-tip p").on("click", function(){
				$(".open-tip").hide();
				shareInOut(10000);
			})

			function getSignatureSucFn(data){
				if(data.code == "0000"){
					var config = data.data;
					if(config != undefined && config != null){
						wx.config({
							debug : false,
							appId : config.AppId,
							timestamp : config.Timestamp,
							nonceStr : config.NonceStr,
							signature : config.Signature,
							jsApiList : [ 'onMenuShareAppMessage','onMenuShareTimeline' ]
						});
					}
				}
			}

			function getMobileSucFn(data){
				if(data.code == "0000"){
					phoneNo = data.data;
					sharelink = 'http://wx.ydche.com/sharegains/sharegains.html?phoneNo='+phoneNo+'&from=singlemessage';
				}else {
					warnText("未获取到当前用户信息！");
				}
			}

			function getStatusSucFn(data){
				if(data.code == "0000"){
					if(data.data== true){
						var urlGetMobile = wxAddress+"/weixin/user/getMobile";
						ajaxEncapsulation(urlGetMobile, getMobileSucFn, "", "GET", "false");
						//调用微信接口
						wx.ready(function() {
							wx.onMenuShareAppMessage({//分享到好友
								title: '让您获利的车险神器',
								desc: '「e车险保」互联网车险交易分享平台。车险在线比价，分享三重获益，保单免费到家。',
								link: sharelink,
								imgUrl: 'http://wx.ydche.com/eInsurance/eShare/images/share.png',
								type: 'link',
								dataUrl: '',
								success: function () { 
									
								},
								cancel: function () { 
								   
								}
							});
							wx.onMenuShareTimeline({//分享到朋友圈
								title: '让您获利的车险神器',
								link: sharelink,
								imgUrl: 'http://wx.ydche.com/eInsurance/eShare/images/share.png',
								trigger: function (res) {
									
								},
								success: function (res) { 
									
								},
								cancel: function (res) { 
									
								},
								fail: function (res) {
									
								}
							});
						})
						shareInOut(1000);
					}
					else{
						warnText("您还未绑定账号，3秒后前往绑定！");
						var locationTimer = setTimeout(function(){
							window.location.href = "../eBoon/bind.html";
						},3000)
					}
				}else {
					warnText("获取用户信息失败！");
				}
			}

			//获取微信接口权限
			var getSignatureUrl = window.location.href.split('#')[0];
			var urlGetSignature = wxAddress+"/weixin/sign/getSignature?url="+getSignatureUrl;
			ajaxEncapsulation(urlGetSignature, getSignatureSucFn, "", "GET", "false");

			//判定用户是否绑定账户
			var phoneNo;
			var sharelink;
			var urlGetStatus = wxAddress+"/weixin/bind/getStatus";
			ajaxEncapsulation(urlGetStatus, getStatusSucFn, "", "GET", "true");

			// 定义提示窗蒙层
			function warnText(textvalue){
				$(".promptmsg").text(textvalue);
				var promptmsgw = "-"+$(".promptmsg").outerWidth()/2+"px";
				$(".promptmsg").css("margin-left", promptmsgw);
				$(".promptmsg").css("top", "50%");
				$(".promptmsg").css("left", "50%");
				$(".promptmsg").show();
				timer = setTimeout(function(){
					clearInterval(timer);
					$(".promptmsg").hide();
				},3000)
			}
		}
	</script>
</body>
</html>